<template>
  <div id="app" ref="chartss" style="width: 360px;height: 80px"></div>
</template>

<script>
import * as echarts from 'echarts'

export default {
  name: 'index',

//  页面初始化完成对dom节点进行操作
  mounted() {
    //  初始化
    let chartsType = echarts.init(this.$refs.chartss)

    chartsType.setOption(
      {
        dataset: {
          source: [
            ['score', 'amount', 'product'],
            [80, 58212, 'Matcha Latte']
          ]
        },
        grid: { containLabel: true },
        xAxis: { name: 'amount', show: false },
        yAxis: { type: 'category', show: false },
        visualMap: {
          orient: 'horizontal',
          left: 'center',
          min: 0,
          max: 100,
          text: ['High Score', 'Low Score'],
          // Map the score column to color
          dimension: 0,
          inRange: {
            color: ['#65B581', '#FFCE34', '#FD665F']
          }
        },
        series: [
          {
            type: 'bar',
            encode: {
              // Map the "amount" column to X axis.
              x: 'amount',
              // Map the "product" column to Y axis
              y: 'product'
            }
          }
        ]
      }
    )
  }
}
</script>

<style scoped>

</style>
